/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.fzhucc.modules.requirement.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author yyg
 * @website https://eladmin.vip
 * @description /
 * @date 2023-02-28
 **/
@Entity
@Data
@Table(name = "tb_requirement")
public class Requirement implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`thinktank_id`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "智库id   可为上市公司id、产业龙头id、产业资本id、院士之家id")
    private Long thinktankId;

    @Column(name = "`thinktank_type`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "智库分类    requirement_thinktank_type")
    private String thinktankType;

    @Column(name = "`title`", nullable = false)
    @NotBlank
    @ApiModelProperty(value = "名称")
    private String title;

    @Column(name = "`unit`")
    @ApiModelProperty(value = "单位")
    private String unit;

    @Column(name = "`name`")
    @ApiModelProperty(value = "联系人姓名")
    private String name;

    @Column(name = "`post`")
    @ApiModelProperty(value = "联系人职务")
    private String post;

    @Column(name = "`phone`")
    @ApiModelProperty(value = "联系方式")
    private String phone;

    @Column(name = "`email`")
    @ApiModelProperty(value = "联系人邮箱")
    private String email;

    @Column(name = "`technical_field`")
    @ApiModelProperty(value = "所需技术领域  technical_field_type")
    private String technicalField;

    @Column(name = "`technical_field_other`")
    @ApiModelProperty(value = "所需技术领域其他  选择技术领域为其他时填写")
    private String technicalFieldOther;

    @Column(name = "`technology_maturity`")
    @ApiModelProperty(value = "所需技术成熟度   technology_maturity_type")
    private String technologyMaturity;

    @Column(name = "`is_long_estimate`")
    @ApiModelProperty(value = "是否长期  技术需求有效时间   是长期  否填写时间段")
    private Integer isLongEstimate;

    @Column(name = "`estimate_time`")
    @ApiModelProperty(value = "技术需求开始时间    is_long_estimate为false才需填写")
    private Timestamp estimateTime;

    @Column(name = "`estimate_end_time`")
    @ApiModelProperty(value = "技术需求结束时间    is_long_estimate为false才需填写")
    private Timestamp estimateEndTime;

    @Column(name = "`cooperation`")
    @ApiModelProperty(value = "拟采用的合作方式  cooperation_type")
    private String cooperation;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "拟采用的研发金额  amount_type")
    private String amount;

    @Column(name = "`cooperation_other`")
    @ApiModelProperty(value = "拟采用的合作方式其他   合作方式为其他时才需填写")
    private String cooperationOther;

    @Column(name = "`describe`")
    @ApiModelProperty(value = "描述")
    private String describe;

    @Column(name = "`pic`")
    @ApiModelProperty(value = "封面")
    private String pic;

    @Column(name = "`sort`")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @Column(name = "`is_show`")
    @ApiModelProperty(value = "是否显示")
    private Integer isShow;

    @ApiModelProperty(value = "地区划分 即什么地区看的到什么地区的数据,省的看到全部")
    @Column(name = "`org_area`",nullable = false)
    @NotNull
    public String orgArea;

    public void copy(Requirement source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
